package com.qhhc.hospital.service.impl;

import com.qhhc.hospital.entity.Bed;
import com.qhhc.hospital.mapper.BedMapper;
import com.qhhc.hospital.service.IBedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BedService implements IBedService {
    @Autowired
    BedMapper bedMapper;
    
    @Override
    public int insert(Bed bed) {
        int count = bedMapper.insertBed(bed);
        return count;
    }
    
    @Override
    public List<Bed> selectAll() {
        List<Bed> beds = bedMapper.selectAllBeds();
        return beds;
    }
    
    @Override
    public Bed selectById(Integer bId) {
        Bed bed = bedMapper.selectBedById(bId);
        return bed;
    }
    
    @Override
    public List<Bed> selectByPatientId(Integer pId) {
        List<Bed> beds = bedMapper.selectBedByPatientId(pId);
        return beds;
    }
    
    @Override
    public List<Bed> selectByDoctorId(Integer dId) {
        List<Bed> beds = bedMapper.selectBedByDoctorId(dId);
        return beds;
    }
    
    @Override
    public int update(Bed bed) {
        return bedMapper.updateBed(bed);
    }
    
    @Override
    public int delete(Integer bId) {
        return bedMapper.deleteBed(bId);
    }
} 